package com.ews.onlineexchange.service.startup;

import javax.annotation.PostConstruct;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.inject.Inject;

import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Deployment;
import org.apache.log4j.Logger;

@Singleton
@Startup
public class AutoPublishProcessDefination {
	
private static Logger logger = Logger.getLogger( AutoPublishProcessDefination.class );

	@Inject
	RepositoryService 	repositoryService;
	
	@PostConstruct
	public void publish() {
//		Deployment deployment = repositoryService.createDeployment().name( getProcessKey() ).key( getProcessKey() ).addBytes( uploadFile.getFileName(), uploadFile.getContents() ).deploy();
//		Deployment deployment = repositoryService.createDeployment().addClasspathResource( "process/BestChooseAudit.bpmn" ).deploy();
//		logger.info( "Deployed process ID: " + deployment.getId() + " KEY " + deployment.getKey() );
	}
	
}
